/*
 * 10.6.cpp 1015_poj
 *
 *  Created on: 2012-5-16
 *      Author: jawinton
 */


#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

#define N 201
#define M 21
#define MAX 801

int f[M][MAX]; //f[j, k]: j表示候选人数, k表示辩控差,辩控差为k的方案中辩控和最大的那个方案的辩控和
int path[M][MAX];//方案f[j, k]中最后选的那个候选人的编号记在path[j][k]中
int P[N], D[N], V[N], S[N];
int ANS[M];

int compare(const void *a, const void *b) {
	return *((int *)a) - *((int *)b);
}

int main (void) {
	int n, m, cases = 0;
	while (true) {
		cases ++;
		scanf("%d%d", &n, &m);
		if (n == 0) break;
		for (int i=0; i<n; i++) {
			scanf("%d%d", &P[i], &D[i]);
			V[i] = P[i] - D[i];
			S[i] = P[i] + D[i];
		}
		memset(f, -1, sizeof(f));
		memset(path, 0, sizeof(path));
		int minP_D = m*20;
		f[0][minP_D] = 0;
		for (int i=0; i<m; i++) {
			for (int j=0; j<=minP_D*2; j++) {
				if (f[i][j] >= 0) {
					for (int k=0; k<n; k++) {
						if (f[i][j] + S[k] > f[i+1][j+V[k]]) {
							int t1 = i, t2 = j;
							while (t1 > 0 && path[t1][t2] != k) {
								t2 -= V[path[t1][t2]];
								t1--;
							}
							if (t1==0) {
								f[i+1][j+V[k]] = f[i][j] + S[k];
								path[i+1][j+V[k]] = k;
							}
						}
					}
				}
			}
		}
		int i = minP_D;
		int j=0, k;
		while (f[m][i+j] < 0 && f[m][i-j] < 0)
			j++;
		if (f[m][i+j] > f[m][i-j]) k = i+j;
		else k = i-j;
		printf("Jury #%d\n",cases);
		printf("Best jury has value %d for prosecution and value %d for defence:\n", (f[m][k]+(k-minP_D))/2, (f[m][k]-(k-minP_D))/2);
		for (i=0; i<m; i++) {
			ANS[i] = path[m-i][k];
			k -= V[ANS[i]];
		}
		qsort(ANS, m, sizeof(int), compare);
		for (i=0; i<m ;i++)
			printf("%d ", ANS[i]+1);
		printf("\n\n");
	}
	return 0;
}
